#include <bits/stdc++.h>
// 2025/07/21
// tag:
// Author: Forever
using namespace std;
#define int long long

int n, s, t, check, a[67], b[67], nxt[67];
bool use[67], flag;

char *p1, *p2, buf[100000];
#define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++)
int read()
{
    int x = 0, f = 1;
    char ch = nc();
    while (ch < 48 || ch > 57) {
        if (ch == '-')
            f = -1;
        ch = nc();
    }
    while (ch >= 48 && ch <= 57)
        x = x * 10 + ch - 48, ch = nc();
    return x * f;
}

void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
    return;
}

inline bool cmp(const int& x, const int& y)
{
    return x > y;
}

void dfs(int num, int sum, int st)
{
    if (num == t) {
        flag = true;
        return;
    }
    int r = max(st + 1, (long long)(lower_bound(a + st + 1, a + n + 1, sum - check) - a));
    if (sum - a[r] > check)
        r++;
    for (int i = r; i <= n; i++) {
        if (use[i])
            continue;
        use[i] = true;
        if (sum - a[i] == check)
            dfs(num + 1, 0, 0);
        else
            dfs(num, sum - a[i], i);
        use[i] = false;
        if (flag || st == 0 || sum - a[i] == check)
            return;
        i = nxt[i];
    }
    return;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    scanf("%d", &n);
    int mx = 0;
    for (int i = 1; i <= n; i++)
        a[i] = read(), s += a[i], a[i] = -a[i];
    sort(a + 1, a + n + 1);
    for (int i = n; i >= 1; i--) 
        nxt[i] = (a[i + 1] == a[i]) ? nxt[i + 1] : i;
    for (int i = -a[1]; i <= s; i++) {
        if (s % i)
            continue;
        check = i, t = s / i;
        dfs(0, 0, 0);
        if (flag) {
            write(check);
            return 0;
        }
    }
    return 0;
}